package com.bwie.auth.controller;

import com.bwie.auth.service.AuthService;
import com.bwie.common.domain.po.UserPo;
import com.bwie.common.domain.response.UserResponse;
import com.bwie.common.domain.vo.UserVo;
import com.bwie.common.result.Result;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Log4j2
public class AuthController {
    @Autowired
    private AuthService authService;

    /**
     * 登录
     */
    @PostMapping("/login")
    public Result<UserResponse> login(@RequestBody UserVo userVo){
        Result<UserResponse> login = authService.login(userVo);
        return login;
    }

    /**
     * 获取info
     */
    @GetMapping("/getInfo")
    public Result getInfo(){
        UserPo info = authService.getInfo();
        Result<UserPo> result = Result.success(info);
        return result;
    }
}
